package tools;


/**
 * Sometimes it is usefull to merge arrays with each other.
 * 
 * Unfortunetaly Java has nothing like array1 + array2 as seen in some
 * other languages. In order to provide a general merge functionality, all
 * these merges are collected in this class.
 */
public final class ArrayMerge {

	/**
	 * Quick method which will merge two arrays.
	 * @param array1 Array on head
	 * @param array2 
	 * @return
	 */
	public static byte[] mergeBytes(byte[] array1, byte[] array2) {
		byte[] newarray = new byte[array1.length + array2.length];
		System.arraycopy(array1, 0, newarray, 0, array1.length);
		System.arraycopy(array2, 0, newarray, array1.length, array2.length);
		return newarray;
	}
}
